package com.drawingtimer.admin.exception;

import com.drawingtimer.admin.enums.BizErrorCodeEnum;

public class BizException extends RuntimeException {

	private final int code;

	private final String message;

	public BizException(BizErrorCodeEnum errorCodeEnum) {
		super(errorCodeEnum.getMessage());
		this.code = errorCodeEnum.getCode();
		this.message = errorCodeEnum.getMessage();
	}

	public BizException(BizErrorCodeEnum errorCodeEnum, Throwable cause) {
		super(errorCodeEnum.getMessage(), cause);
		this.code = errorCodeEnum.getCode();
		this.message = errorCodeEnum.getMessage();
	}

	public BizException(int code, String message) {
		super(message);
		this.code = code;
		this.message = message;
	}

	public int getCode() {
		return code;
	}

	@Override
	public String getMessage() {
		return message;
	}

}
